#pragma once
#include<iostream>
#include<vector>
#include<initializer_list>
using namespace std;

class Solution
{
public:
	void blast(vector<vector<int>> &nums)
	{
		int m = nums.size(),n=nums[0].size();
		vector<int> sum1(m + 1);
		vector<int> sum2(n + 1);
		for (int i = 0; i < m; ++i)
			for (int j = 0; j <n; ++j)
				sum1[i] += nums[i][j];
		for (int i = 0; i < m; ++i)
			for (int j = 0; j < n; ++j)
				sum2[j] += nums[i][j];
		for (int i = 0; i < m; ++i)
		{
			for (int j = 0; j < n; ++j)
				cout << sum1[i] + sum2[j] - nums[i][j]<<" ";
			cout << endl;
		}
	}

	void peach(vector<vector<int>>& nums,int k)
	{
		int n = nums[0].size();
		long long hMax=0,hSum=0,sMin=0,sSum=0,ans=0;
		for (int left = 1, right = 1;right<n;++right)
		{
			hSum += nums[0][right];
			sSum += nums[1][right];
			if(right - left + 1 > k)
			{
				hSum -= nums[0][left];
				sSum -= nums[1][left++];
			}

			if (right - left + 1 == k)
			{
				if (hSum > hMax || (hSum == hMax && sSum < sMin))
				{
					hMax = hSum;
					sMin = sSum;
					ans = left;
				}
			}
		}
		cout << ans;
	}
};